//
//  Sysmenu.m
//  isMan
//
//  Created by Xing Lion on 11-6-20.
//  Copyright 2011年 InspurWorld. All rights reserved.
//

#import "Sysmenu.h"

#import "HelloWorldLayer.h"
#import "GameOver.h"
#import "SettingsLayer.h"
@implementation Sysmenu
+(id) scene
{
	// 'scene' is an autorelease object.
	CCScene *scene = [CCScene node];
	
	// 'layer' is an autorelease object.
	Sysmenu *layer = [Sysmenu node];
	
	// add layer as a child to scene
	[scene addChild: layer];
	
	// return the scene
	return scene;
}

- (id) init
{
	self = [super init];
	if (self)
	{
		CCSprite *sp = [CCSprite spriteWithFile:@"480_320.jpg"];
		sp.anchorPoint = ccp(0,0);
        
		[self addChild:sp z:0 tag:1];
		
        //		[MenuItemFont setFontName:@"Marker Felt"];
		[CCMenuItemFont setFontSize:25];
		
		CCMenuItem *newGame = [CCMenuItemFont itemFromString:@"开始游戏" target:self selector:@selector(newGame:)];

		CCMenuItem *GameSttings = [CCMenuItemFont itemFromString:@"设置" target:self selector:@selector(OnSettings:)];

		
		CCMenu *mn = [CCMenu menuWithItems:newGame, GameSttings, nil];
		[mn alignItemsVertically];
		
		[self addChild:mn z:1 tag:2];
        
	}
	
	return self;
}


- (void) newGame:(id) sender
{
	CCScene *sc = [CCScene node];
	[sc addChild:[HelloWorldLayer node]];
	
	[[CCDirector sharedDirector] replaceScene: sc];
    

    	
}

- (void) OnSettings:(id) sender
{
//	CCScene *sc = [CCScene node];
//	[sc addChild:[SettingsLayer node]];
//	
//	[[CCDirector sharedDirector] replaceScene: [CCShrinkGrowTransition transitionWithDuration:1.2f scene:sc]];
	
    
    CCScene *sc = [CCScene node];
	[sc addChild:[SettingsLayer node]];
	
	[[CCDirector sharedDirector] replaceScene: sc];
}



- (void) dealloc
{
	[super dealloc];
}
@end
